package com.itheima.vms.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.itheima.vms.domain.PageResult;
import com.itheima.vms.domain.dto.SupplierDto;
import com.itheima.vms.domain.po.Supplier;
import com.itheima.vms.mapper.SupplierMapper;
import com.itheima.vms.service.ISupplierService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 渠道商表 服务实现类
 * </p>
 *
 * @author shenkunlin
 * @since 2025-08-02
 */
@Service
public class SupplierServiceImpl extends ServiceImpl<SupplierMapper, Supplier> implements ISupplierService {
    @Autowired
    private SupplierMapper supplierMapper;

    //分页查询
    @Override
    public PageResult<Supplier> getPage(SupplierDto dto) {
        PageHelper.startPage(dto.getPage(),dto.getPageSize());
        List<Supplier> list = supplierMapper.getPage(dto);
        Page<Supplier> supplierPage = (Page<Supplier>) list;
        return new PageResult(supplierPage.getResult(),supplierPage.getTotal());
    }
}
